import api from '../../api';
import { message } from 'antd';

export default {
  namespace: 'productStatisticsM',
  state: {},
  effects: {
    // 获取产品统计相关信息接口
    *queryProductStatistics({ payload, callback }, { call, put }) {
      const response = yield call(api.productStatistics.queryProductStatistics, payload);
      if (response && response.code == 0) {
        callback(response.data);
      } else {
        callback();
        message.error(response?.msg || '获取产品统计信息失败！');
      }
    },
  },

  reducers: {
    setState(state, { payload }) {
      return {
        ...state,
        ...payload,
      };
    },
  },
};
